import { Controller } from "../../mvc/core/Controller";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { IView } from "../../mvc/interfaces/IView";
import { GMModule } from "../../../modules/GMModule";
import { DataEvent } from "../events/DataEvent";
import { GameProxy } from "../mvc/GameProxy";
import { IGMModule } from "../../../modules/interfaces/IGMModule";
type int = number;
//class GMController
    
    export  class GMController extends Controller
    {
        constructor()
        {
            
            super();Dispatcher.addEventListener(EventName.MailSendGmReport, this.onMailSendGmReport);
            Dispatcher.addEventListener(EventName.MailSendGmReportSuccess, this.onMailSendGmReportSuccess);
            return;
        }

        public /* override */ get view(): IView
        {
            return this.initView();
        }

        protected /* override */ initView(): IView
        {
            if (null == this._gmModule) 
            {
                this._gmModule = new GMModule();
            }
            return this._gmModule;
        }

        protected /* override */ initServer(): void
        {
            return;
        }

        /* internal  */onMailSendGmReport(arg1: DataEvent): void
        {
            var loc1=arg1.data["type"] as int;
            var loc2=arg1.data["title"] as string;
            var loc3=arg1.data["content"] as string;
            GameProxy.mailProxy.sendGmReport(loc1, loc2, loc3);
            return;
        }

        /* internal  */onMailSendGmReportSuccess(arg1: DataEvent): void
        {
            this._gmModule.onSendSuccess();
            return;
        }

        private /* var */_gmModule: IGMModule;
    }
